From 20e890933569e89b1f150a5007aaba49231cdf65 Mon Sep 17 00:00:00 2001 From: "kfraser@localhost.localdomain" Date: Mon, 14 Aug 2006 16:12:43 +0100 Subject: [PATCH] [LINUX] Oney 'nosmp' and 'max_cpus=' command line options. Based on a patch from Jan Beulich. Signed-off-by: Keir Fraser --- .../drivers/xen/core/smpboot.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/linux-2.6-xen-sparse/drivers/xen/core/smpboot.c b/linux-2.6-xen-sparse/drivers/xen/core/smpboot.c index 71990e04d5..2538791d0e 100644 --- a/linux-2.6-xen-sparse/drivers/xen/core/smpboot.c +++ b/linux-2.6-xen-sparse/drivers/xen/core/smpboot.c @@ -255,7 +255,14 @@ void __init smp_prepare_cpus(unsigned int max_cpus) xen_smp_intr_init(0); - for_each_cpu_mask (cpu, cpu_possible_map) { + /* Restrict the possible_map according to max_cpus. */ + while ((num_possible_cpus() > 1) && (num_possible_cpus() > max_cpus)) { + for (cpu = NR_CPUS-1; !cpu_isset(cpu, cpu_possible_map); cpu--) + continue; + cpu_clear(cpu, cpu_possible_map); + } + + for_each_cpu (cpu) { if (cpu == 0) continue; @@ -266,7 +273,8 @@ void __init smp_prepare_cpus(unsigned int max_cpus) #endif gdt_descr->address = get_zeroed_page(GFP_KERNEL); if (unlikely(!gdt_descr->address)) { - printk(KERN_CRIT "CPU%d failed to allocate GDT\n", cpu); + printk(KERN_CRIT "CPU%d failed to allocate GDT\n", + cpu); continue; } gdt_descr->size = GDT_SIZE; @@ -305,12 +313,6 @@ void __init smp_prepare_cpus(unsigned int max_cpus) init_xenbus_allowed_cpumask(); - /* Currently, Xen gives no dynamic NUMA/HT info. */ - for (cpu = 1; cpu < NR_CPUS; cpu++) { - cpu_sibling_map[cpu] = cpumask_of_cpu(cpu); - cpu_core_map[cpu] = cpumask_of_cpu(cpu); - } - #ifdef CONFIG_X86_IO_APIC /* * Here we can be sure that there is an IO-APIC in the system. Let's -- 2.30.2